package com.azusa.xbiao.entity;

import javax.persistence.*;

@Entity
@Table(name = "resource")
public class Resource {
    private int id;
    private String title;
    private String navUrl;

    @Id
    @Column(name = "id", table = "resource", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "title", table = "resource", nullable = true, length = 255)
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @Basic
    @Column(name = "nav_url", table = "resource", nullable = true, length = 255)
    public String getNavUrl() {
        return navUrl;
    }

    public void setNavUrl(String navUrl) {
        this.navUrl = navUrl;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Resource resource = (Resource) o;

        if (id != resource.id) return false;
        if (title != null ? !title.equals(resource.title) : resource.title != null) return false;
        if (navUrl != null ? !navUrl.equals(resource.navUrl) : resource.navUrl != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (title != null ? title.hashCode() : 0);
        result = 31 * result + (navUrl != null ? navUrl.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "Resource{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", navUrl='" + navUrl + '\'' +
                '}';
    }
}
